"""
语法：
不修改原始数据：
    add  => 加
    sub  => 减
    mul  => 乘
    div  => 除
    neg  => 取反
修改原始数据：
    add_  => 加
    sub_  => 减
    mul_  => 乘
    div_  => 除
    neg_  => 取反
"""
import torch as t

data = t.randint(0, 10, [3, 4])
print(data)

print("-------------add-------------")
data = data.add(10)
print(data)

print("-------------sub-------------")
data = data.sub(10)
print(data)

print("-------------mul-------------")
data = data.mul(2)
print(data)

print("-------------div-------------")
data = data.div(2)
print(data)

print("-------------neg-------------")
data = data.neg()
print(data)

print("---------------华丽的分割线---------------")
data2 = t.Tensor(3, 4)
print(data2)

print("-------------add_-------------")
data2.add_(10)
print(data2)

print("-------------sub_-------------")
data2.sub_(10)
print(data2)

print("-------------mul_-------------")
data2.mul_(2)
print(data2)

print("-------------div_-------------")
data2.div_(2)
print(data2)

print("-------------neg_-------------")
data2.neg_()
print(data2)